#!/usr/bin/env python
# encoding: utf-8


"""
@file: junzhibudengshi.py
@time: 2016/11/22 下午3:04
"""
# 均值不等式
# 已知eq 求 poly的最值问题
from mathsolver.functions.root.jiefangchenzu import *
from mathsolver.functions.budengshi.ave_value_ineqs import (AveValueIneq001, JiDingHeZuiXiao, OpValueWithNum,
                                                            JunZhiBuDengshi005, AveValueIneq003, JunzhiBudengshi007,
                                                            JunzhiBudengshi008, JunZhiBuDengShi013)
from mathsolver.functions.budengshi.junzhibudengshi.jidinghezuixiao import JiDingHeZuiXiao as JDHZX


# 所有[已知eq 求 poly的最值问题]均值不等式的入口问题
# input: paramer1:条件(正数，实数，.....); paramrer2: 等式eq; paramer3: 目标poly
class JunZhiBuDengShi(BaseFunction):
    CLS = [AveValueIneq001, JiDingHeZuiXiao, OpValueWithNum, JunZhiBuDengshi005, AveValueIneq003, JunzhiBudengshi007,
           JunzhiBudengshi008, JunZhiBuDengShi013, JDHZX]

    def solver(self, *args):
        r = None
        for cl in JunZhiBuDengShi.CLS:
            try:
                r = cl(verbose=True).solver(*args)
                break
            except Exception:
                pass
        if not r:
            raise 'try fail'
        return r
